# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=esptool
pkgver=4.7.0
pkgrel=0
pkgdesc="ESP8266 and ESP32 serial bootloader utility"
url="https://docs.espressif.com/projects/esptool"
license="GPL-2.0-or-later"
arch="noarch"
depends="
	py3-bitstring
	py3-cryptography
	py3-ecdsa
	py3-intelhex
	py3-pyserial
	py3-reedsolo
	py3-yaml
	"
makedepends="py3-gpep517 py3-installer py3-setuptools py3-wheel"
checkdepends="py3-elftools py3-pkcs11 py3-pytest py3-requests"
subpackages="$pkgname-pyc"
source="https://github.com/espressif/esptool/archive/v$pkgver/esptool-$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -m host_test
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
dda2af5d9b2f8a4ec5706eaf58021e95094c152380c732074809c370a5d1bfaeb424cb27f69a3b980dec83ae9c4c9ee1eddfeb0a7990c3b1f1494160a2d369cc  esptool-4.7.0.tar.gz
"
